package com.jlect.swebing.ui.client;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * Notifies component listeners about the events
 *
 * @author Sergey Kozmin
 * @since 16.11.2007 9:35:21
 */
public class ComponentListenerCollection extends ArrayList {
    private ComponentEvent event; 
    public ComponentListenerCollection(GComponent component) {
        event = new ComponentEvent(component);
    }

    public void fireComponentResized() {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            ComponentListener listener = (ComponentListener) iterator.next();
            listener.componentResized(event);
        }
    }

    public void fireComponentMoved() {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            ComponentListener listener = (ComponentListener) iterator.next();
            listener.componentMoved(event);
        }
    }

    public void fireComponentShown() {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            ComponentListener listener = (ComponentListener) iterator.next();
            listener.componentShown(event);
        }
    }

    public void fireComponentHidden() {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            ComponentListener listener = (ComponentListener) iterator.next();
            listener.componentHidden(event);
        }
    }
}
